<extend name="Application/Admin/View/Layout/application.html"/>

<block name="css">
    <style>
        #page2 {
            display: none;
        }
    </style>
</block>


<block name="content">
    <div class="row">
        <div class="col-md-12">

            <div class="row">
                <div class="col-md-8">
                    <div class="page-header">
                        <h1>文章列表</h1>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-heading">文章列表</div>

                        <div class="panel-body">
                            <form action="" method="post" id="form">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox" id="check_all"></th>
                                        <th>标题</th>
                                        <th>所属栏目</th>
                                        <th>发布日期</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>


                                    <volist name="articles" id="a">
                                        <tr>
                                            <th scope="row">
                                                <input type="checkbox" class="delete_checked" name="delete_ids[]" value="{{$a.id}}"></th>
                                            <td class="title">{{$a.title}}</td>
                                            <td class="categort_name">{{$a.category.name}}</td>
                                            <td>
                                                <input type="hidden" name="ids[]" value="{{$a.id}}">
                                                {{$a.date|date="Y-m-d",###}}
                                            </td>
                                            <td>
                                                <a href="{{:U('add')}}">
                                                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                                                </a>
                                                <a href="{{:U('edit',array('id'=>$a['id']))}}"  class="edit">
                                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                                </a>
                                                <a href="{{:U('destroy',array('id'=>$a['id']))}}">
                                                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                                                </a>
                                            </td>
                                        </tr>
                                    </volist>


                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="col-md-2">
                    <div class="list-group">
                        <a href="{{:U('add')}}" class="list-group-item list-group-item-info ">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增 (add)
                        </a>

                        <a href="" class="list-group-item list-group-item-info destroy_checked">
                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除 (destroy)
                        </a>


                    </div>
                </div>
            </div>
        </div>
    </div>
</block>
<block name="js">
    <script>
        $(function () {
            $("#check_all").click(function () {
                //所有checkbox跟着全选的checkbox走。
                $('.delete_checked').prop("checked", this.checked);
            });
        });
    </script>
</block>